import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './pages/home/home.component';
import { HistoryComponent } from './pages/history/history.component';
import { MenuComponent } from './components/menu/menu.component';
import { PersonComponent } from './pages/person/person.component';
import { CourseComponent } from './pages/course/course.component';
import { RecommendComponent } from './pages/home/recommend/recommend.component';
import { HomeCookComponent } from './pages/home/home-cook/home-cook.component';
import { SnackComponent } from './pages/home/snack/snack.component';
import { PastryComponent } from './pages/home/pastry/pastry.component';
import { LoginComponent } from './pages/login/login.component';
import { LogonComponent } from './pages/logon/logon.component';
import { UsermodComponent } from './pages/usermod/usermod.component';


const routes: Routes = [
  {
    path: 'home', component: HomeComponent,
    children: [
      { path: '', component: RecommendComponent },
      { path: 'homeCook', component: HomeCookComponent },
      { path: 'snack', component: SnackComponent },
      { path: 'pastry', component: PastryComponent }
    ]
  },
  { path: '', redirectTo: 'home', pathMatch: 'full' },
  {
    path: 'person', component: PersonComponent,
    children: [
      { path: 'history', component: HistoryComponent }
    ]
  },
  { path: 'course/:id', component: CourseComponent },
  { path: 'login', component: LoginComponent },
  { path: 'logon', component: LogonComponent },
  { path: 'usermod', component: UsermodComponent }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
